From b8739ce658fb4e782bb7cf1eb0729dea56880127 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 7 Sep 2014 10:53:20 -0700 Subject: [PATCH] Move to rustdoc instead of ruby's middleman * All markdown files are now rendered with `rustdoc` into HTML * A JS syntax highlighter, prism, is included for TOML syntax highlighting. * A new makefile target, `make doc`, will build docs into `target/doc` --- .travis.yml | 6 +- Makefile.in | 25 +++ configure | 7 + src/doc/{source => }/CNAME | 0 src/doc/Gemfile | 18 -- src/doc/Gemfile.lock | 134 -------------- src/doc/{source => }/config.md | 4 +- src/doc/config.rb | 83 --------- src/doc/{source => }/faq.md | 18 +- src/doc/footer.html | 11 ++ src/doc/{source => }/guide.md | 20 +-- src/doc/header.html | 11 ++ .../{source => }/images/Cargo-Logo-Small.png | Bin src/doc/{source => }/images/forkme.png | Bin src/doc/{source => }/images/noise.png | Bin src/doc/{source => }/index.md | 10 +- src/doc/javascripts/all.js | 28 +++ src/doc/javascripts/prism.js | 6 + src/doc/{source => }/manifest.md | 6 +- src/doc/{source => }/native-build.md | 4 +- src/doc/source/javascripts/all.js | 1 - src/doc/source/layouts/layout.erb | 35 ---- src/doc/source/stylesheets/all.css.scss | 169 ------------------ src/doc/source/stylesheets/colors.css.scss | 12 -- src/doc/source/stylesheets/fonts.css.scss | 1 - src/doc/source/stylesheets/solarized.css.scss | 71 -------- src/doc/stylesheets/all.css | 147 +++++++++++++++ .../{source => }/stylesheets/normalize.css | 0 src/doc/stylesheets/prism.css | 133 ++++++++++++++ 29 files changed, 395 insertions(+), 565 deletions(-) rename src/doc/{source => }/CNAME (100%) delete mode 100644 src/doc/Gemfile delete mode 100644 src/doc/Gemfile.lock rename src/doc/{source => }/config.md (98%) delete mode 100644 src/doc/config.rb rename src/doc/{source => }/faq.md (88%) create mode 100644 src/doc/footer.html rename src/doc/{source => }/guide.md (96%) create mode 100644 src/doc/header.html rename src/doc/{source => }/images/Cargo-Logo-Small.png (100%) rename src/doc/{source => }/images/forkme.png (100%) rename src/doc/{source => }/images/noise.png (100%) rename src/doc/{source => }/index.md (91%) create mode 100644 src/doc/javascripts/all.js create mode 100644 src/doc/javascripts/prism.js rename src/doc/{source => }/manifest.md (99%) rename src/doc/{source => }/native-build.md (99%) delete mode 100644 src/doc/source/javascripts/all.js delete mode 100644 src/doc/source/layouts/layout.erb delete mode 100644 src/doc/source/stylesheets/all.css.scss delete mode 100644 src/doc/source/stylesheets/colors.css.scss delete mode 100644 src/doc/source/stylesheets/fonts.css.scss delete mode 100644 src/doc/source/stylesheets/solarized.css.scss create mode 100644 src/doc/stylesheets/all.css rename src/doc/{source => }/stylesheets/normalize.css (100%) create mode 100644 src/doc/stylesheets/prism.css diff --git a/.travis.yml b/.travis.yml index 598fa6024..0872cef5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,16 +6,14 @@ script: - make - make test - make distcheck + - make doc after_success: | [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && [ $BITS = 64 ] && [ $(uname -s) = Linux ] && - (cd src/doc && - bundle && - bundle exec middleman build) && sudo pip install ghp-import && - ghp-import -n src/doc/build && + ghp-import -n target/doc && git push -f https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages env: matrix: diff --git a/Makefile.in b/Makefile.in index 47f7656fc..e02333fa5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -96,6 +96,31 @@ clean-all: clean clean: rm -rf $(TARGET_ROOT) +# === Documentation + +DOCS := index faq config guide manifest native-build +DOC_DIR := target/doc +DOC_OPTS := --markdown-no-toc \ + --markdown-css stylesheets/normalize.css \ + --markdown-css stylesheets/all.css \ + --markdown-css stylesheets/prism.css \ + --html-before-content src/doc/header.html \ + --html-after-content src/doc/footer.html +ASSETS := CNAME images/noise.png images/forkme.png images/Cargo-Logo-Small.png \ + stylesheets/all.css stylesheets/normalize.css javascripts/prism.js \ + javascripts/all.js stylesheets/prism.css + +doc: $(foreach doc,$(DOCS),target/doc/$(doc).html) \ + $(foreach asset,$(ASSETS),target/doc/$(asset)) + +$(DOC_DIR)/%.html: src/doc/%.md src/doc/header.html src/doc/footer.html + @mkdir -p $(@D) + "$(CFG_RUSTDOC)" $< -o $(@D) $(DOC_OPTS) + +$(DOC_DIR)/%: src/doc/% + @mkdir -p $(@D) + cp $< $@ + # === Distribution define DO_DIST_TARGET diff --git a/configure b/configure index a263e55c4..bb0085b99 100755 --- a/configure +++ b/configure @@ -342,6 +342,12 @@ step_msg "looking for build programs" probe_need CFG_CURLORWGET curl wget probe_need CFG_PYTHON python +if [ ! -z "${CFG_LOCAL_RUST_ROOT}" ]; then + CFG_RUSTDOC="${CFG_LOCAL_RUST_ROOT}/bin/rustdoc" +else + probe_need CFG_RUSTDOC rustdoc +fi + # a little post-processing of various config values CFG_PREFIX=${CFG_PREFIX%/} CFG_MANDIR=${CFG_MANDIR%/} @@ -372,6 +378,7 @@ putvar CFG_TARGET putvar CFG_LIBDIR putvar CFG_MANDIR putvar CFG_RUSTC +putvar CFG_RUSTDOC msg copy_if_changed ${CFG_SRC_DIR}Makefile.in ./Makefile diff --git a/src/doc/source/CNAME b/src/doc/CNAME similarity index 100% rename from src/doc/source/CNAME rename to src/doc/CNAME diff --git a/src/doc/Gemfile b/src/doc/Gemfile deleted file mode 100644 index afd0d1a26..000000000 --- a/src/doc/Gemfile +++ /dev/null @@ -1,18 +0,0 @@ -# If you have OpenSSL installed, we recommend updating -# the following line to use "https" -source 'http://rubygems.org' - -gem "middleman", "~>3.3.3" -gem "middleman-blog" - -gem "middleman-syntax" -gem "redcarpet" - -# Live-reloading plugin -gem "middleman-livereload", "~> 3.1.0" - -# For faster file watcher updates on Windows: -gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw] - -# Windows does not come with time zone data -gem "tzinfo-data", platforms: [:mswin, :mingw] diff --git a/src/doc/Gemfile.lock b/src/doc/Gemfile.lock deleted file mode 100644 index 4ba15d29e..000000000 --- a/src/doc/Gemfile.lock +++ /dev/null @@ -1,134 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - activesupport (4.1.1) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - addressable (2.3.6) - chunky_png (1.3.1) - coffee-script (2.2.0) - coffee-script-source - execjs - coffee-script-source (1.7.0) - compass (0.12.6) - chunky_png (~> 1.2) - fssm (>= 0.2.7) - sass (~> 3.2.19) - compass-import-once (1.0.4) - sass (>= 3.2, < 3.5) - em-websocket (0.5.1) - eventmachine (>= 0.12.9) - http_parser.rb (~> 0.6.0) - erubis (2.7.0) - eventmachine (1.0.3) - execjs (2.2.0) - ffi (1.9.3) - fssm (0.2.10) - haml (4.0.5) - tilt - hike (1.2.3) - hooks (0.4.0) - uber (~> 0.0.4) - http_parser.rb (0.6.0) - i18n (0.6.9) - json (1.8.1) - kramdown (1.4.0) - listen (1.3.1) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9) - rb-kqueue (>= 0.2) - middleman (3.3.3) - coffee-script (~> 2.2.0) - compass (>= 0.12.4) - compass-import-once (= 1.0.4) - execjs (~> 2.0) - haml (>= 4.0.5) - kramdown (~> 1.2) - middleman-core (= 3.3.3) - middleman-sprockets (>= 3.1.2) - sass (>= 3.2.17, < 4.0) - uglifier (~> 2.5) - middleman-blog (3.5.3) - addressable (~> 2.3.5) - middleman-core (~> 3.2) - tzinfo (>= 0.3.0) - middleman-core (3.3.3) - activesupport (~> 4.1.0) - bundler (~> 1.1) - erubis - hooks (~> 0.3) - i18n (~> 0.6.9) - listen (~> 1.1) - padrino-helpers (~> 0.12.1) - rack (>= 1.4.5, < 2.0) - rack-test (~> 0.6.2) - thor (>= 0.15.2, < 2.0) - tilt (~> 1.4.1, < 2.0) - middleman-livereload (3.1.1) - em-websocket (>= 0.2.0) - middleman-core (>= 3.0.2) - multi_json (~> 1.0) - rack-livereload - middleman-sprockets (3.3.3) - middleman-core (>= 3.2) - sprockets (~> 2.2) - sprockets-helpers (~> 1.1.0) - sprockets-sass (~> 1.1.0) - middleman-syntax (2.0.0) - middleman-core (~> 3.2) - rouge (~> 1.0) - minitest (5.3.5) - multi_json (1.10.1) - padrino-helpers (0.12.2) - i18n (~> 0.6, >= 0.6.7) - padrino-support (= 0.12.2) - tilt (~> 1.4.1) - padrino-support (0.12.2) - activesupport (>= 3.1) - rack (1.5.2) - rack-livereload (0.3.15) - rack - rack-test (0.6.2) - rack (>= 1.0) - rb-fsevent (0.9.4) - rb-inotify (0.9.5) - ffi (>= 0.5.0) - rb-kqueue (0.2.3) - ffi (>= 0.5.0) - redcarpet (2.3.0) - rouge (1.4.0) - sass (3.2.19) - sprockets (2.12.1) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-helpers (1.1.0) - sprockets (~> 2.0) - sprockets-sass (1.1.0) - sprockets (~> 2.0) - tilt (~> 1.1) - thor (0.19.1) - thread_safe (0.3.4) - tilt (1.4.1) - tzinfo (1.2.1) - thread_safe (~> 0.1) - uber (0.0.6) - uglifier (2.5.1) - execjs (>= 0.3.0) - json (>= 1.8.0) - -PLATFORMS - ruby - -DEPENDENCIES - middleman (~> 3.3.3) - middleman-blog - middleman-livereload (~> 3.1.0) - middleman-syntax - redcarpet - tzinfo-data - wdm (~> 0.1.0) diff --git a/src/doc/source/config.md b/src/doc/config.md similarity index 98% rename from src/doc/source/config.md rename to src/doc/config.md index efc0befc3..721ace2b2 100644 --- a/src/doc/source/config.md +++ b/src/doc/config.md @@ -1,6 +1,4 @@ ---- -title: Configuration ---- +% Configuration This document will explain how cargo's configuration system works, as well as available keys or configuration. For configuration of a project through its diff --git a/src/doc/config.rb b/src/doc/config.rb deleted file mode 100644 index fe4d7f234..000000000 --- a/src/doc/config.rb +++ /dev/null @@ -1,83 +0,0 @@ -### -# Compass -### - -# Change Compass configuration -# compass_config do |config| -# config.output_style = :compact -# end - -### -# Page options, layouts, aliases and proxies -### - -# Per-page layout changes: -# -# With no layout -# page "/path/to/file.html", :layout => false -# -# With alternative layout -# page "/path/to/file.html", :layout => :otherlayout -# -# A path which all have the same layout -# with_layout :admin do -# page "/admin/*" -# end - -# Proxy pages (http://middlemanapp.com/basics/dynamic-pages/) -# proxy "/this-page-has-no-template.html", "/template-file.html", :locals => { -# :which_fake_page => "Rendering a fake page with a local variable" } - -### -# Helpers -### - -# Automatic image dimensions on image_tag helper - activate :automatic_image_sizes - -# Reload the browser automatically whenever files change -configure :development do - activate :livereload -end - -# Methods defined in the helpers block are available in templates -# helpers do -# def some_helper -# "Helping" -# end -# end - -activate :syntax - -set :css_dir, 'stylesheets' - -set :js_dir, 'javascripts' - -set :images_dir, 'images' - -set :fonts_dir, 'fonts' - -set :markdown_engine, :redcarpet -set :markdown, :fenced_code_blocks => true, :smartypants => true - -set :relative_links, true - -ignore "**/*.ttf" - -# Build-specific configuration -configure :build do - # For example, change the Compass output style for deployment - # activate :minify_css - - # Minify Javascript on build - # activate :minify_javascript - - # Enable cache buster - # activate :asset_hash - - # Use relative URLs - activate :relative_assets - - # Or use a different image path - # set :http_prefix, "/Content/images/" -end diff --git a/src/doc/source/faq.md b/src/doc/faq.md similarity index 88% rename from src/doc/source/faq.md rename to src/doc/faq.md index 2ee3c974e..5c6e0576d 100644 --- a/src/doc/source/faq.md +++ b/src/doc/faq.md @@ -1,8 +1,6 @@ ---- -title: Frequently Asked Questions ---- +% Frequently Asked Questions -# Is the plan to use Github as a package repository? ¶ +# Is the plan to use Github as a package repository? No. The plan for Cargo is to have a central registry of packages, like npm or Rubygems. @@ -18,7 +16,7 @@ track the latest Rust. This makes downloading the latest `master` from Github the best approach to getting packages at the current point in the community's lifecycle. -# Why build a package registry rather than use Github as a registry? ¶ +# Why build a package registry rather than use Github as a registry? We think that it's very important to support multiple ways to download packages, including downloading from Github and copying packages into @@ -52,7 +50,7 @@ languages include: down fast. Also remember that not everybody has a high-speed, low-latency Internet connection. -# Will Cargo work with C code (or other languages)? ¶ +# Will Cargo work with C code (or other languages)? Yes! @@ -65,7 +63,7 @@ before invoking `rustc`. We plan to add support for platform-specific configuration, so you can use `make` on Linux and `cmake` on BSD, for example. -# Can Cargo be used inside of `make` (or `ninja`, or ...) ¶ +# Can Cargo be used inside of `make` (or `ninja`, or ...) Indeed. While we intend Cargo to be useful as a standalone way to compile Rust projects at the top-level, we know that some people will @@ -77,7 +75,7 @@ have some work to do on those fronts, but using Cargo in the context of conventional scripts is something we designed for from the beginning and will continue to prioritize. -# Does Cargo handle multi-platform projects or cross-compilation? ¶ +# Does Cargo handle multi-platform projects or cross-compilation? Rust itself provides facilities for configuring sections of code based on the platform. We plan to support per-platform configuration in @@ -87,7 +85,7 @@ future. In the longer-term, we're looking at ways to conveniently cross-compile projects using Cargo. -# Does Cargo support environments, like `production` or `test`? ¶ +# Does Cargo support environments, like `production` or `test`? We are planning on support environments in the near future, that can support: @@ -103,7 +101,7 @@ specify flags or dependencies for a combination of multiple environments and platforms ("use `fsevents`, but only in OSX in `development` or `test`"). -# Does Cargo work on Windows? ¶ +# Does Cargo work on Windows? Yes! diff --git a/src/doc/footer.html b/src/doc/footer.html new file mode 100644 index 000000000..040a6ee03 --- /dev/null +++ b/src/doc/footer.html @@ -0,0 +1,11 @@ + + + + + diff --git a/src/doc/source/guide.md b/src/doc/guide.md similarity index 96% rename from src/doc/source/guide.md rename to src/doc/guide.md index c826d0194..107fbb6d5 100644 --- a/src/doc/source/guide.md +++ b/src/doc/guide.md @@ -1,6 +1,4 @@ ---- -title: Guide ---- +% Guide Welcome to the Cargo guide. This guide will give you all that you need to know about how to use Cargo to develop Rust projects. @@ -65,7 +63,7 @@ needs to compile your project. Here's what's in `src/main.rs`: -```rs +``` fn main() { println!("Hello, world!") } @@ -73,7 +71,7 @@ fn main() { Cargo generated a 'hello world' for us. Let's compile it: -
$ cargo build
+
$ cargo build
    Compiling hello_world v0.0.1 (file:///path/to/project/hello_world)
@@ -86,7 +84,7 @@ Hello, world! We can also use `cargo run` to compile and then run it, all in one step: -
$ cargo run
+
$ cargo run
      Fresh hello_world v0.0.1 (file:///path/to/project/hello_world)
 $ cargo build
+
$ cargo build
    Compiling color v0.0.1 (file:///path/to/project/color-rs)
This will fetch all of the dependencies and then build them, along with the @@ -138,7 +136,7 @@ between different color types. Now, you can pull in that library using `extern crate` in `main.rs`. -```rs +``` extern crate color; use color::{Rgb, ToHsv}; @@ -152,12 +150,12 @@ fn main() { Let's tell Cargo to fetch this new dependency and update the `Cargo.lock`: -
$ cargo update color
+
$ cargo update color
     Updating git repository `https://github.com/bjz/color-rs.git`
Compile it: -
$ cargo run
+
$ cargo run
    Compiling color v0.0.1 (https://github.com/bjz/color-rs.git#bf739419)
    Compiling hello_world v0.0.1 (file:///path/to/project/hello_world)
      Running `target/hello_world`
@@ -373,7 +371,7 @@ the files in `tests`.
 
 To run your tests, just run `cargo test`:
 
-
$ cargo test
+
$ cargo test
    Compiling color v0.0.1 (https://github.com/bjz/color-rs.git#bf739419)
 
+  
+
+
+
+
+

+ Cargo downloads your Rust + project's dependencies and builds your project +

diff --git a/src/doc/source/images/Cargo-Logo-Small.png b/src/doc/images/Cargo-Logo-Small.png similarity index 100% rename from src/doc/source/images/Cargo-Logo-Small.png rename to src/doc/images/Cargo-Logo-Small.png diff --git a/src/doc/source/images/forkme.png b/src/doc/images/forkme.png similarity index 100% rename from src/doc/source/images/forkme.png rename to src/doc/images/forkme.png diff --git a/src/doc/source/images/noise.png b/src/doc/images/noise.png similarity index 100% rename from src/doc/source/images/noise.png rename to src/doc/images/noise.png diff --git a/src/doc/source/index.md b/src/doc/index.md similarity index 91% rename from src/doc/source/index.md rename to src/doc/index.md index ecc77d563..1df9fc728 100644 --- a/src/doc/source/index.md +++ b/src/doc/index.md @@ -1,6 +1,4 @@ ---- -title: Cargo, Rust's Package Manager ---- +% Cargo, Rust's Package Manager # Installing @@ -58,7 +56,7 @@ needs to compile your project. Here's what's in `src/main.rs`: -```rs +``` fn main() { println!("Hello, world!") } @@ -66,7 +64,7 @@ fn main() { Cargo generated a 'hello world' for us. Let's compile it: -
$ cargo build
+
$ cargo build
    Compiling hello_world v0.0.1 (file:///path/to/project/hello_world)
@@ -79,7 +77,7 @@ Hello, world! We can also use `cargo run` to compile and then run it, all in one step: -
$ cargo run
+
$ cargo run
      Fresh hello_world v0.0.1 (file:///path/to/project/hello_world)
 e.length)break e;if(!(d instanceof a)){c.lastIndex=0;var m=c.exec(d);if(m){u&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),N=[p,1];b&&N.push(b);var O=new a(l,g?t.tokenize(m,g):m,h);N.push(O),w&&N.push(w),Array.prototype.splice.apply(r,N)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("[object Array]"==Object.prototype.toString.call(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var i={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}t.hooks.run("wrap",i);var o="";for(var s in i.attributes)o+=s+'="'+(i.attributes[s]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+o+">"+i.content+""},!self.document)return self.addEventListener?(self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code;self.postMessage(JSON.stringify(t.util.encode(t.tokenize(r,t.languages[a])))),self.close()},!1),self.Prism):self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism);;
+Prism.languages.markup={comment://g,prolog:/<\?.+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/\&#?[\da-z]{1,8};/gi},Prism.hooks.add("wrap",function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))});;
+Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/gi,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,punctuation:/[\{\};:]/g,"function":/[-a-z0-9]+(?=\()/gi},Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/gi,inside:{tag:{pattern:/|<\/style>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});;
+Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//g,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*?(\r?\n|$)/g,lookbehind:!0}],string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/gi,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/gi,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};;
+Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/[\w\W]*?<\/script>/gi,inside:{tag:{pattern:/|<\/script>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});;
diff --git a/src/doc/source/manifest.md b/src/doc/manifest.md
similarity index 99%
rename from src/doc/source/manifest.md
rename to src/doc/manifest.md
index 0480aeaec..87a9aeb83 100644
--- a/src/doc/source/manifest.md
+++ b/src/doc/manifest.md
@@ -1,6 +1,4 @@
----
-title: The Manifest Format
----
+% The Manifest Format
 
 # The `[package]` Section
 
@@ -152,7 +150,7 @@ executables.
 When you run `cargo build`, Cargo will compile all of these files into
 the `target` directory.
 
-```
+```notrust
 ▾ src/          # directory containing source files
   ▾ bin/        # (optional) directory containing executables
     *.rs
diff --git a/src/doc/source/native-build.md b/src/doc/native-build.md
similarity index 99%
rename from src/doc/source/native-build.md
rename to src/doc/native-build.md
index bc253fa89..6fa5d9740 100644
--- a/src/doc/source/native-build.md
+++ b/src/doc/native-build.md
@@ -1,6 +1,4 @@
----
-title: Building external code
----
+% Building external code
 
 Some packages need to compile third-party non-Rust code that you will
 link into your Rust code using `#[link]` (more information on `#[link]`
diff --git a/src/doc/source/javascripts/all.js b/src/doc/source/javascripts/all.js
deleted file mode 100644
index 2becd765c..000000000
--- a/src/doc/source/javascripts/all.js
+++ /dev/null
@@ -1 +0,0 @@
-//= require_tree .
\ No newline at end of file
diff --git a/src/doc/source/layouts/layout.erb b/src/doc/source/layouts/layout.erb
deleted file mode 100644
index e1555473b..000000000
--- a/src/doc/source/layouts/layout.erb
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-  
-    
-
-    
-    
-
-    
-    <%= current_page.data.title || "The Middleman" %>
-
-    <%= stylesheet_link_tag "all" %>
-    <%= javascript_include_tag  "all" %>
-  
-
-  
-    <%= link_to image_tag("forkme.png", class: "fork-me"), "https://github.com/rust-lang/cargo" %>
-    <%= link_to image_tag("Cargo-Logo-Small.png", class: "logo"), "index.html" %>
-
-    
-

Cargo downloads your Rust project's dependencies and builds your project

- - <%= yield %> - - -
- - - diff --git a/src/doc/source/stylesheets/all.css.scss b/src/doc/source/stylesheets/all.css.scss deleted file mode 100644 index 6e8b9fdd4..000000000 --- a/src/doc/source/stylesheets/all.css.scss +++ /dev/null @@ -1,169 +0,0 @@ -@charset "utf-8"; -@import "compass/reset"; -@import "compass/css3/images"; -@import "fonts"; -@import "solarized"; -@import "colors"; - -html { - @include background(image-url("noise.png"), radial-gradient(top - center, circle, $light-green 0%, $dark-green 750px)); -} - -pre { - font-family: monospace; - font-size: 110%; -} - -body { - font-family: sans-serif; -} - -* { - box-sizing: border-box; -} - -body { - display: flex; - flex-direction: column; - align-items: center; -} - -a { - color: $orange; - - &:hover { - color: $purple; - } -} - -h1 { - font-size: 24px; - margin: 20px 0 10px 0; - font-weight: bold; - color: $purple; - - code:not(.highlight) { - color: darken($orange, 5%); - vertical-align: bottom; - } - - &:hover { - .headerlink { - display: inline-block; - } - } -} - -h1:first-child { - margin-top: 0; -} - -h2 { - font-size: 18px; - margin: 15px 0 5px 0; - color: $purple; - font-weight: bold; - - code:not(.highlight) { - color: darken($orange, 5%); - } -} - -code:not(.highlight) { - font-family: monospace; - font-size: 110%; - color: $purple; -} - -main { - display: flex; - flex-direction: column; - - max-width: 900px; - margin-bottom: 10px; - - background-color: $cream; - padding: 15px; - border-radius: 5px; - box-shadow: 0px 0px 5px 2px $dark-green; - - p:first-child { - color: $light-green; - font-weight: 500; - margin-top: 3px; - padding-bottom: 15px; - border-bottom: 1px solid $second-green; - text-align: center; - - a { - color: $dark-green; - - &:hover { - color: $second-green; - } - } - } - - p, ul { - color: $dark-green; - margin: 10px 0; - line-height: 150%; - } - - ul { - margin-left: 20px; - } - - li { - list-style-type: disc; - } - - strong { - font-weight: bold; - } -} - -img.logo { - align-self: center; - margin-bottom: 10px; -} - -pre { - background: $beige; - padding: 10px; - margin: 10px 0; - border: 1px solid lighten(#93a1a1, 20%); - border-radius: 4px; - line-height: 120%; - max-width: calc(100vw - 45px); - overflow-x: auto; -} - -footer { - margin-top: 10px; - border-top: 1px solid $purple; - padding-top: 10px; - width: 100%; - text-align: center; - - a { - color: $purple; - text-decoration: none; - - &:hover { - text-decoration: underline; - } - } -} - -.headerlink { - display: none; - text-decoration: none; -} - -.fork-me { - position:absolute; - top:0; - right:0; -} diff --git a/src/doc/source/stylesheets/colors.css.scss b/src/doc/source/stylesheets/colors.css.scss deleted file mode 100644 index 08a8e1297..000000000 --- a/src/doc/source/stylesheets/colors.css.scss +++ /dev/null @@ -1,12 +0,0 @@ -// primary -$dark-green: #3B6837; -$light-green: #199B5C; -$purple: #B64790; -$orange: #F3BB00; - -// secondary -$second-green: #62865F; -$beige: #EEECDD; -$cream: #F9F7EC; -$dark-cream: #FFF2C8; - diff --git a/src/doc/source/stylesheets/fonts.css.scss b/src/doc/source/stylesheets/fonts.css.scss deleted file mode 100644 index 09709a454..000000000 --- a/src/doc/source/stylesheets/fonts.css.scss +++ /dev/null @@ -1 +0,0 @@ -@import "compass/css3"; diff --git a/src/doc/source/stylesheets/solarized.css.scss b/src/doc/source/stylesheets/solarized.css.scss deleted file mode 100644 index 0c7657006..000000000 --- a/src/doc/source/stylesheets/solarized.css.scss +++ /dev/null @@ -1,71 +0,0 @@ -@import "colors"; - -.highlight { background-color: $beige; color: #586E75 } -.highlight .c { color: #93A1A1 } /* Comment */ -.highlight .err { color: #93A1A1 } /* Error */ -.highlight .g { color: #93A1A1 } /* Generic */ -.highlight .k { color: #859900 } /* Keyword */ -.highlight .l { color: #93A1A1 } /* Literal */ -.highlight .n { color: #CB4B16 } /* Name */ -.highlight .o { color: #859900 } /* Operator */ -.highlight .x { color: #CB4B16 } /* Other */ -.highlight .p { color: #586E75 } /* Punctuation */ -.highlight .cm { color: #586E75 } /* Comment.Multiline */ -.highlight .cp { color: #859900 } /* Comment.Preproc */ -.highlight .c1 { color: #586E75 } /* Comment.Single */ -.highlight .cs { color: #859900 } /* Comment.Special */ -.highlight .gd { color: #2AA198 } /* Generic.Deleted */ -.highlight .ge { color: #93A1A1; font-style: italic } /* Generic.Emph */ -.highlight .gr { color: #DC322F } /* Generic.Error */ -.highlight .gh { color: #CB4B16 } /* Generic.Heading */ -.highlight .gi { color: #859900 } /* Generic.Inserted */ -.highlight .go { color: #93A1A1 } /* Generic.Output */ -.highlight .gp { color: #93A1A1 } /* Generic.Prompt */ -.highlight .gs { color: #93A1A1; font-weight: bold } /* Generic.Strong */ -.highlight .gu { color: #CB4B16 } /* Generic.Subheading */ -.highlight .gt { color: #93A1A1 } /* Generic.Traceback */ -.highlight .kc { color: #CB4B16 } /* Keyword.Constant */ -.highlight .kd { color: #268BD2 } /* Keyword.Declaration */ -.highlight .kn { color: #859900 } /* Keyword.Namespace */ -.highlight .kp { color: #859900 } /* Keyword.Pseudo */ -.highlight .kr { color: #268BD2 } /* Keyword.Reserved */ -.highlight .kt { color: #DC322F } /* Keyword.Type */ -.highlight .ld { color: #93A1A1 } /* Literal.Date */ -.highlight .m { color: #2AA198 } /* Literal.Number */ -.highlight .s { color: #2AA198 } /* Literal.String */ -.highlight .na { color: #93A1A1 } /* Name.Attribute */ -.highlight .nb { color: #B58900 } /* Name.Builtin */ -.highlight .nc { color: #268BD2 } /* Name.Class */ -.highlight .no { color: #CB4B16 } /* Name.Constant */ -.highlight .nd { color: #268BD2 } /* Name.Decorator */ -.highlight .ni { color: #CB4B16 } /* Name.Entity */ -.highlight .ne { color: #CB4B16 } /* Name.Exception */ -.highlight .nf { color: #268BD2 } /* Name.Function */ -.highlight .nl { color: #93A1A1 } /* Name.Label */ -.highlight .nn { color: #CB4B16 } /* Name.Namespace */ -.highlight .nx { color: #93A1A1 } /* Name.Other */ -.highlight .py { color: #268BD2 } /* Name.Property */ -.highlight .nt { color: #268BD2 } /* Name.Tag */ -.highlight .nv { color: #268BD2 } /* Name.Variable */ -.highlight .ow { color: #859900 } /* Operator.Word */ -.highlight .w { color: #93A1A1 } /* Text.Whitespace */ -.highlight .mf { color: #2AA198 } /* Literal.Number.Float */ -.highlight .mh { color: #2AA198 } /* Literal.Number.Hex */ -.highlight .mi { color: #2AA198 } /* Literal.Number.Integer */ -.highlight .mo { color: #2AA198 } /* Literal.Number.Oct */ -.highlight .sb { color: #586E75 } /* Literal.String.Backtick */ -.highlight .sc { color: #2AA198 } /* Literal.String.Char */ -.highlight .sd { color: #93A1A1 } /* Literal.String.Doc */ -.highlight .s2 { color: #2AA198 } /* Literal.String.Double */ -.highlight .se { color: #CB4B16 } /* Literal.String.Escape */ -.highlight .sh { color: #93A1A1 } /* Literal.String.Heredoc */ -.highlight .si { color: #2AA198 } /* Literal.String.Interpol */ -.highlight .sx { color: #2AA198 } /* Literal.String.Other */ -.highlight .sr { color: #DC322F } /* Literal.String.Regex */ -.highlight .s1 { color: #2AA198 } /* Literal.String.Single */ -.highlight .ss { color: #2AA198 } /* Literal.String.Symbol */ -.highlight .bp { color: #268BD2 } /* Name.Builtin.Pseudo */ -.highlight .vc { color: #268BD2 } /* Name.Variable.Class */ -.highlight .vg { color: #268BD2 } /* Name.Variable.Global */ -.highlight .vi { color: #268BD2 } /* Name.Variable.Instance */ -.highlight .il { color: #2AA198 } /* Literal.Number.Integer.Long */ diff --git a/src/doc/stylesheets/all.css b/src/doc/stylesheets/all.css new file mode 100644 index 000000000..2fbdf3a97 --- /dev/null +++ b/src/doc/stylesheets/all.css @@ -0,0 +1,147 @@ +html { + background: url("../images/noise.png"); + background-color: #3b6837; +} + +body { + font-family: sans-serif; +} + +* { + box-sizing: border-box; +} + +body { + display: flex; + flex-direction: column; + align-items: center; +} + +a { color: #f3bb00; } +a:hover { color: #b64790; } + +h1 { + font-size: 24px; + margin: 20px 0 10px 0; + font-weight: bold; + color: #b64790; +} + +h1 code:not(.highlight) { + color: #d9a700; + vertical-align: bottom; +} +h1 a, h2 a { color: #b64790; text-decoration: none; } +h1:hover a:after, +h2:hover a:after{ content: '\2002\00a7\2002'; } +h1.title { display: none; } /* hide rustdoc-generated title */ +:target { background: rgba(239, 242, 178, 1); padding: 5px; } + +h2 { + font-size: 18px; + margin: 15px 0 5px 0; + color: #b64790; + font-weight: bold; +} + +h2 code:not(.highlight) { color: #d9a700; } + +code:not(.highlight) { + font-family: monospace; + color: #b64790; +} + +main { + display: flex; + flex-direction: column; + + max-width: 900px; + margin-bottom: 10px; + + background-color: #f9f7ec; + padding: 15px; + border-radius: 5px; + box-shadow: 0px 0px 5px 2px #3b6837; +} + +main p:first-child { + color: #199b5c; + font-weight: 500; + margin-top: 3px; + padding-bottom: 15px; + border-bottom: 1px solid #62865f; + text-align: center; +} + +main p:first-child a { color: #3b6837; } +main p:first-child a:hover { color: #62865f; } + +main p, main ul { + color: #3b6837; + margin: 10px 0; + line-height: 150%; +} + +main ul { margin-left: 20px; } +main li { list-style-type: disc; } +main strong { font-weight: bold; } + +img.logo { + align-self: center; + margin-bottom: 10px; +} + +pre { + padding: 10px; + margin: 10px 0; + border: 1px solid #cad0d0; + border-radius: 4px; + max-width: calc(100vw - 45px); + overflow-x: auto; + + /* override prism.js styles for fonts */ + font-size: 1em !important; + background: #eeecdd !important; +} + +footer { + margin-top: 10px; + border-top: 1px solid #b64790; + padding-top: 10px; + width: 100%; + text-align: center; + +} +footer a { + color: #b64790; + text-decoration: none; +} +footer a:hover { + text-decoration: underline; +} + +.headerlink { + display: none; + text-decoration: none; +} + +.fork-me { + position:absolute; + top:0; + right:0; +} + +.token.toml-section { color: #CB4B16; } +.token.toml-key { color: #268BD2; } + +/* Rust code highlighting */ +pre.rust .kw { color: #8959A8; } +pre.rust .kw-2, pre.rust .prelude-ty { color: #4271AE; } +pre.rust .number, pre.rust .string { color: #718C00; } +pre.rust .self, pre.rust .boolval, pre.rust .prelude-val, +pre.rust .attribute, pre.rust .attribute .ident { color: #C82829; } +pre.rust .comment { color: #8E908C; } +pre.rust .doccomment { color: #4D4D4C; } +pre.rust .macro, pre.rust .macro-nonterminal { color: #3E999F; } +pre.rust .lifetime { color: #B76514; } +code span.s1 { color: #2AA198; } diff --git a/src/doc/source/stylesheets/normalize.css b/src/doc/stylesheets/normalize.css similarity index 100% rename from src/doc/source/stylesheets/normalize.css rename to src/doc/stylesheets/normalize.css diff --git a/src/doc/stylesheets/prism.css b/src/doc/stylesheets/prism.css new file mode 100644 index 000000000..6cc4523c5 --- /dev/null +++ b/src/doc/stylesheets/prism.css @@ -0,0 +1,133 @@ +/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript */ +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + */ + +code[class*="language-"], +pre[class*="language-"] { + color: black; + text-shadow: 0 1px white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, +code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { + text-shadow: none; + background: #b3d4fc; +} + +pre[class*="language-"]::selection, pre[class*="language-"] ::selection, +code[class*="language-"]::selection, code[class*="language-"] ::selection { + text-shadow: none; + background: #b3d4fc; +} + +@media print { + code[class*="language-"], + pre[class*="language-"] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background: #f5f2f0; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string, +.token.variable { + color: #a67f59; + background: hsla(0, 0%, 100%, .5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function { + color: #DD4A68; +} + +.token.regex, +.token.important { + color: #e90; +} + +.token.important { + font-weight: bold; +} + +.token.entity { + cursor: help; +} + -- 2.30.2